<?php
require("../../../../class2.php");
require("../../plugin.php");
$sql->db_Select($e107shop_db_name["settings"], "*", "");
while ($row=$sql->db_Fetch()) {
    $shop_settings = $row;
}
$thumbsize = $shop_settings['thumbnail_size'] + 50;
?>
<script language="JavaScript">
function sendValue(s){
    //var selvalue = s.options[s.selectedIndex].value;
    window.opener.document.productform.large_image.value = s;
    window.close();
}
</script>
<center><table width="985px" bgcolor="#8FB3E9"><tr>
<td bgcolor="#4D7ABC" style='color: white; text-align: center; font-size: 14pt;'>
<b>Product Images</b>
</td>
</tr>
<tr>
<td style="padding-left: 11px;">
<?php

$handler = opendir("../../images/products/");
while($file=readdir($handler)){
    $pictures[] = $file;
}
sort($pictures);
foreach($pictures as $key => $value) {
    if($value!='.' && $value!='..' && $value!='index.php' && !ereg("^\.",$value) && $value!='Thumbs.db'){
        $value = htmlspecialchars($value);
        echo "<a href=\"javascript:sendValue('".$value."')\" onClick='sendValue('".$value."');'>
        <img src='".e_IMAGE_ABS."thumb.php?".$e107->file_path.$PLUGINS_DIRECTORY.$eplug_folder."/images/products/".$value."+".$thumbsize."+noscale' 
        alt='".$value."' border='0'></a>&nbsp;";
        $i++;
        if(!($i % 7)){
               echo "<br>";
        }
    }
}

?>
</td>
</tr>
</table>